alter table "RequestIndentHeader" drop column "PaymentNoOfDays";

alter table "RequestIndentHeader" add column "ApprovedBy" int references "Account"("AccountId"),
		add column "ApprovedDate" timestamp without time zone;

insert into "ProductRaiseStatus" ("Status") values ('MovedToTenderList'),('PartiallyApproved');

create table "RaiseTenderHeader"(
				"RaiseTenderHeaderId" serial primary key,
				"TenderNumber" varchar(250),
				"CreatedBy" int references "Account"("AccountId"),
				"CreatedDate" timestamp without time zone,
				"Active" boolean default true,
				"ProductRaiseStatusId" int references "ProductRaiseStatus"("ProductRaiseStatusId"),
				"RequiredDate" date,
				"PaymentClearDays" int,
				"PaymentMode" varchar(250)
);

create table "RaiseTenderDetail"(
				"RaiseTenderDetailId" serial primary key,
				"RaiseTenderHeaderId" int references "RaiseTenderHeader"("RaiseTenderHeaderId"),
				"RequestIndentDetailId" int references "RequestIndentDetail"("RequestIndentDetailId")
);

create table "TenderSendedToVendor"(
		"TenderSendedToVendorId" serial primary key,
		"RaiseTenderHeaderId" int references "RaiseTenderHeader"("RaiseTenderHeaderId"),
		"CreatedDate" timestamp without time zone,
		"CreatedBy" int references "Account"("AccountId")		
);



insert into "ProductRaiseStatus" ("Status") values ('TenderRaised');


alter table "TenderSendedToVendor" add column "SupplierId" int references "Supplier"("SupplierId"),
  add column "ProductRaiseStatusId" int references "ProductRaiseStatus"("ProductRaiseStatusId");

